import pymysql
import re
def use_mysql(sql,host='47.108.206.100',user='student',password='stu2022',database='mall',port=3306):
    db=pymysql.connect(host=host,user=user,password=password,database=database,port=port)
    cursor=db.cursor()
    if re.match('^select',sql.lower()) is not None:
        cursor.execute(sql)
        return cursor.fetchall()
    else:
        cursor.execute(sql)
        db.commit()
    cursor.close()
    db.close()
